{extend name="public:common_edit"/}
{block name="main"}

<style>
    .tipStyle {
        display: none;
        position: absolute;
        background-color: #FBEC88;
        font-size: 16px;
        border-right: #D0EAF9 solid 1px;
        border-bottom: #D0EAF9 solid 1px;
        border-left: #D0EAF9 solid 1px;
        border-top: #D0EAF9 solid 1px;
    }

</style>

<div id="kyqToolTip" class="tipStyle"></div>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-list"></i> 聊天记录</h3>
        </div>
        <div class="panel-body">

            <div class="navbar navbar-default">
                <form action="" id="search-form2" class="navbar-form form-inline" method="get" onsubmit="return false">

                    <div class="form-group">
                        <label class="control-label" >用户ID:</label>
                        <div class="input-group">
                            <input type="number" name="uuid" value="{$Think.get.uuid}" placeholder="用户ID" class="form-control">
                        </div>

                    </div>

                    <div class="form-group">
                        <label class="control-label" >时间</label>
                        <div class="input-group">
                            <input type="text"   name="date"  autocomplete="off" value="{$Think.get.date}" placeholder="选择开始时间"
                                   class="form-control timepicker1">
                        </div>
                    </div>


                    <button type="submit" onclick="javascript:document.getElementById('search-form2').submit();"
                            id="button-filter search-order" class="btn btn-primary"><i class="fa fa-search"></i> 筛选
                    </button>

                </form>
            </div>
            <div id="ajax_return">
                <form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <td>发送时间</td>
                                <td>发送人ID</td>
                                <td>发送人昵称</td>
                                <td>发送人头像</td>
                                <td>消息类型</td>
                                <td>内容</td>
                                <td>接收人ID</td>
                                <td>接收人昵称</td>
                                <td>接收人头像</td>
                            </tr>
                            </thead>
                            <tbody>
                            <!-- 列表循环开始 -->
                            {volist name="rows" id="row" key="key"}
                            <tr>
                                <td>{$row.dateTime}</td>
                                <td>{$row.formInfo.user_id}</td>
                                <td>{$row.formInfo.nick_name}</td>
                                <td><img style="max-width: 80px" src=" {$row.formInfo.header_img}"  alt=""></td>
                                <?php if($row['classname'] == 'RC:TxtMsg')
                                { echo "<td> 文字</td><td class=\"emojstext\">". $row['content']['content']."</td>";}
                                else{ echo '<td>图片</td><td class="emojstext">' ."<img src=\'". $row['content']['content'] ."\' style='max-width: 100px' > </td>"; } ?>
                                <td>{$row.targetInfo.user_id}</td>
                                <td>{$row.targetInfo.nick_name}</td>
                                <td><img style="max-width: 80px" src=" {$row.targetInfo.header_img}"  alt=""></td>
                            </tr>
                            {/volist}
                            <!-- 列表循环结束 -->
                            </tbody>
                        </table>
                    </div>
                </form>
            </div>

        </div>
    </div>
{/block}
{block name="js"}

<script src="__JS__/boxImg.js" type="text/javascript" ></script>
<link rel="stylesheet" type="text/css" href="__CSS__/boxImg.css">


<script>

    $(function () {
        //防止事件冒泡
        $(document).delegate('.timepicker1','focusin', function(){
            $('.timepicker1').datetimepicker({
                format: 'yyyymmddHH',
                minView: "day",
                language:  'zh-CN',
                weekStart: 1,
                todayBtn:  0,
                autoclose: 1,
                startDate:'2020-01-01',
                maxView:3,
                endDate:0,
                todayHighlight: 1,
                startView: 2,
                forceParse: 0,
                showMeridian: false
            });
        });
    });


    $(".doubleBtn").on("dblclick", function(){
        var html    = $(this).data('ip');
        var user_id = $(this).data('id');
        var message = '将要封禁设备(ip):'+html;
        var url = "{:url('band')}?IMEI="+html+'&user_id='+user_id;
        layer.confirm(message, {
            btn: ['继续','放弃'] //按钮
        }, function(){
            $.ajax({
                url: url,
                type: 'GET',
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                success: function (result) {
                    if (result.code == 1) {
                        successRedirect(result.msg, result.url, 1);
                    } else {
                        zcAlert(result.msg,0);
                        layer.closeAll("loading");
                        btn.attr('disabled', false);
                    }
                },
                error: function () {
                    layer.msg('请求失败,网络连接超时', {icon: 5, time: 2000});
                    layer.closeAll("loading");
                    btn.attr('disabled', false);
                }
            });
        }, function(){
            layer.msg('操作已取消');
        });

    });

    function openUri(uri) {
        layer.open({
            type: 2,
            title: '用户信息编辑',
            shadeClose: true,
            shade: 0.8,
            area: ['90%', '90%'],
            content:uri //iframe的url
        });
    }


    var pointX;
    var pointY;

    $('.success').click(function () {
        var _that = $(this);

        layer.prompt({title: '封禁时间(小时 0为永久封禁)', formType: 0}, function(pass, index){
            layer.close(index);
            var url = $($(_that).next('.change')).data('url');
            url += '?end_time='+pass;
            $($(_that).next('.change')).data('url',url);
            $($(_that).next('.change')).click();
        });



    });

    function showTip(str){

        if(str.length > 0){
            $("#kyqToolTip").css("display","block");
            $("#kyqToolTip").css("left",pointX+10);
            $("#kyqToolTip").css("top",pointY-10);
            $("#kyqToolTip").html(str);
        }
    }

    // 添加菜单
    $(".txtstyle").bind("mouseover",function(e){
        pointX = e.pageX;
        pointY = e.pageY;
        var html = $(this).data('str');
        html = jEmoji.softbankToUnified(html);
        html = jEmoji.googleToUnified(html);
        html = jEmoji.docomoToUnified(html);
        html = jEmoji.kddiToUnified(html);
        showTip(jEmoji.unifiedToHTML(html));
    }).bind("mouseout",function(e){
        closeTip()
    }).bind("mousedown",function(e){
        closeTip()
    });

    function closeTip() {
        $("#kyqToolTip").css("display","none");
    }


    var status   = "{$Think.get.status}";
    if(status != ''){
        $('#status'+status).attr('selected',true)
    }

    var sex   = "{$Think.get.sex}";
    if(sex != ''){
        $('#sex'+sex).attr('selected',true)
    }

    var register_name   = "{$Think.get.register_name}";
    if(register_name != ''){
        $('#register_name'+register_name).attr('selected',true)
    }



    function add() {
        $("input[name='title'],input[name='name']").val('');
        $("input[name='pid']").val(0);
        $('#bjy-add').modal('show');
    }

    function customer() {
        $("input[name='title'],input[name='url'],input[name='user_id']").val('');
        $('#customer').modal('show');
    }


    $(function () {

        $.each($('.emojstext'),function (k,v) {
            var $text = $(v);
            var html = $text.html().trim().replace(/\n/g, '<br/>');
            html = jEmoji.softbankToUnified(html);
            html = jEmoji.googleToUnified(html);
            html = jEmoji.docomoToUnified(html);
            html = jEmoji.kddiToUnified(html);
            $text.html(jEmoji.unifiedToHTML(html));
        });

        var is_agent = "{$Think.get.is_agent}";
        $('#is_agent'+is_agent).attr('selected','selected')
    })

    var url = "{:url('user/user_batch')}";//批量操作

</script>

{include file="user/js" /}
{/block}




